<?
/*
     * @author : Tran Thi Kim Que
     * @method : get object like from # id
     * @param  : 
     * @date   : 27/11/2012
     * @modify :
     */
	 function getObjectLike($table,$record_id){
		$ci = get_instance();
        $ci->db->select('like');
		$ci->db->where($table."_id",$record_id);
		$ci->db->where('bl_active',1);
        return $ci->db->get($table)->row();
    }
	//update like
	function update_like($table,$record_id,$record_value)
	{
		$ci = get_instance();
		$ci->db->select('like');
		$ci->db->where($record_id,$record_value);
		$query = $ci->db->get($table);
		$row = $query->row();
		$like_old = $row->like;
		$data_update = array("like"=>$like_old+1);
		$ci->db->where($record_id,$record_value);
		if($ci->db->update($table,$data_update)){
			return $like_old+1;
		 }
		 return $like_old;
	}
?>